﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CPS1
{
    // NUDY: Patrz VaultSignal
    public class SinSOSignal : Signal
    {
        public SinSOSignal(Double A, Double T, Double t1, Double d, Double f, String name) 
        {
            this.A = A;
            this.T = T;
            this.t1 = t1;
            this.d = d;
            this.f = f;
            this.name = name;
            this.periodical = true;
            this.discrete = false;

            int amount = (int) Math.Ceiling(d * f);
            this.calculatedValues = new Double[amount, 2];
        }

        override public Double value(Double t) 
        {
            // wszystko z wzorków z instrukcji
            return ((1.0 / 2.0) * this.A) * (Math.Sin(((2 * Math.PI) / this.T) * (t - this.t1)) + Math.Abs(Math.Sin(((2 * Math.PI) / this.T) * (t - this.t1))));
        }

        public override Signal copy()
        {
            SinSOSignal copied = new SinSOSignal(this.A, this.T, this.t1, this.d, this.f, this.name);
            copied.calculateSignal();
            return copied;
        }
    }
}
